Skip to content

feature: support measure_ff and cc_prx gates#103

Merged
rmshaffer merged 6 commits into
mainfrom
rmshaffer/classical-control-gates
May 8, 2026
Merged

feature: support measure_ff and cc_prx gates#103
rmshaffer merged 6 commits into
mainfrom
rmshaffer/classical-control-gates

Conversation

@rmshaffer
Copy link
Copy Markdown
Contributor

@rmshaffer rmshaffer commented May 4, 2026

Issue #, if available:

Description of changes:

Adds two IQM classical-control gate wrappers: measure_ff (a measurement that writes to a feedback key) and cc_prx (a classically-controlled prx gate guarded by that feedback key).

Testing done:

tox passes.

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (aaf7238) to head (6dd9d28).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #103   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           50        50           
  Lines         2163      2201   +38     
  Branches       250       254    +4     
=========================================
+ Hits          2163      2201   +38     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rmshaffer rmshaffer marked this pull request as ready for review May 4, 2026 17:48
@rmshaffer rmshaffer requested a review from a team as a code owner May 4, 2026 17:48
Comment thread test/unit_tests/autoqasm/test_classical_control.py
self.simulation.evolve(self.context.pop_instructions())
targets = self.context.get_qubits(qubits[0])
outcome = self.simulation.measure(targets)
try:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ff_name should not exist because IQM demands feedback key to be unique. So the behavior here is different from IQM's. Alternative is:

if ff_name in self.symbol_table:
    raise ValueException()

self.context.declare_variable(ff_name, BitType(size=None)) 

@rmshaffer rmshaffer merged commit 9d23d5a into main May 8, 2026
18 checks passed
@rmshaffer rmshaffer deleted the rmshaffer/classical-control-gates branch May 8, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants